package com.cy.uv.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cy.uv.entity.Order;
import com.cy.uv.mapper.OrderMapper;
import com.cy.uv.service.OrderService;

import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements OrderService {

    private final OrderMapper orderMapper;
    public Order getOrderByUsername(String username){
        if (orderMapper.getOrderByUsername(username)==null)
            return null;
        return orderMapper.getOrderByUsername(username);
    }

    @Override
    public Integer orderisOK(Integer orderid) {
        Order order = new Order();
        order = orderMapper.selectById(orderid);
        return order.getStatus();
    }
}
